package com.tiny.persistence.repository.impl;

import java.util.List;
import java.util.Map;

import javax.persistence.Query;

import org.apache.log4j.Logger;

import com.tiny.persistence.domain.ForumSorterReply;
/**
 * 清分机使用交流区
 * 回复帖子仓储层
* @ClassName:  
* @Description: TODO 
* @author:  
* @date: 2014年3月23日
*
 */
public class ForumSorterReplyRepoImpl extends BaseRepoImpl<ForumSorterReply> {

    private static Logger logger = Logger.getLogger(ForumSorterReplyRepoImpl.class);

    @Override
    public List<ForumSorterReply> getListByCondition(Map<String, Object> condition) {
        Query query = em.createQuery("from ForumSorterReply as re");
        
        //query.setFirstResult(arg0);
        //query.setMaxResults(arg0);
        
        List<ForumSorterReply> list = query.getResultList();
        
        logger.info("======= " + list);
        
        return list;
    }

    @Override
    public int getCountByCondition(Map<String, Object> condition) {
        
        Query query = em.createQuery("select count(*) from ForumSorterReply as au");
        Object obj = query.getSingleResult();
        
        logger.info("======= count=" + obj);
        
        return Integer.parseInt(obj.toString());
    }
    
    
}
